# -*- coding: utf-8 -*-
from sqlalchemy import Column, Integer, String, DateTime, Text
from datetime import datetime
from database import Base

class Article(Base):
    __tablename__ = 'articles'
    
    id = Column(Integer, primary_key=True, index=True)
    title = Column(String(255), nullable=True)
    auth = Column(String(255), nullable=True)
    content = Column(Text(), nullable=True)
    created_at = Column(DateTime, default=datetime.utcnow)
    updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)

if __name__ == '__main__':
    from database import engine 
    Article.__table__.create(bind=engine, checkfirst=True)